package com.fjec.market.feign;

import com.fjec.market.feign.config.FeignConfig;
import com.fjec.market.feign.fallback.PaidClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "paid-serv", fallback = PaidClientFallback.class, configuration = FeignConfig.class)
public interface PaidClient {
    @PostMapping("/api/phy/order/divide/save/batch")
    int writePhyDistributionInfoBatch(@RequestBody List<Map<String, Object>> ordersToDivide);

    @PostMapping("/api/serv/order/divide/save/batch")
    int writeServDistributionInfoBatch(@RequestBody List<Map<String, Object>> ordersToDivide);

    @RequestMapping(method = RequestMethod.POST, value = "/api/order/complaint/refund")
    int refund(@RequestParam("id") Long complaintId,
               @RequestParam("orderId") Long orderId,
               @RequestParam("subOrderId") Long subOrderId,
               @RequestParam("amount") String amount);


    @RequestMapping(method = RequestMethod.POST, value = "/api/order/get/dist/info")
    List<Map<String, Object>> getDistInfosByPaymentIds(@RequestBody List<Long> paymentIds);

    @RequestMapping(method = RequestMethod.POST, value = "/api/order/get/refund/info")
    List<Map<String, Object>> getRefundInfosBySubOrderIds(@RequestBody List<Long> subOrderIds);

    @RequestMapping(method = RequestMethod.GET, value = "/api/order/get/total/account/amount")
    int getTotalAccountAmount(@RequestParam("payeeUserCode") String payeeUserCode);

    @RequestMapping(method = RequestMethod.POST, value = "/api/order/ys/deliver")
    int ysDelivery(@RequestParam("paymentId") Long paymentId);

    @RequestMapping(method = RequestMethod.POST, value = "/api/order/ys/sign")
    int ysSign(@RequestParam("paymentId") Long paymentId);
}
